The LINKAGE
section describes data made available from another program through the CALL statement. The data structure defined in a
LINKAGE
section should be located in a COPYBOOK. Otherwise, at runtime multiple COBOL programs may try to share data structures which are
not similar.
First level data items can also be defined in the main program as long as there are no structural pieces of information attached to this first
level like the length, the format, and so on.
This rule raises an issue only on the first invalid data item of a LINKAGE
section.
Noncompliant code example
LINKAGE SECTION.
01 LK-DATA. *> Noncompliant
05 LK-LENGTH PIC S9(04) COMP.
05 LK-VARIABLE PIC X(08).
Compliant solution
LINKAGE SECTION.
COPY MY_COPYBOOK.
or
LINKAGE SECTION.
01 LK-DATA.
COPY MY_COPYBOOK.